//
//  PenWidthViewController.m
//  Cachalot
//
//  Created by Adam Cue on 4/19/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "PenWidthViewController.h"
#import "AnnotationView.h"


@implementation PenWidthViewController

@synthesize penWidthPopover = _penWidthPopover;
@synthesize annotationViews = _annotationViews;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil annotationViews:(NSMutableArray *)selectedAnnotationViews{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.annotationViews = selectedAnnotationViews;
    }
    return self;
}

- (void)dealloc {
	self.annotationViews = nil;
   self.penWidthPopover = nil;
   
   [super dealloc];
}

#pragma mark ExternalMethods
- (IBAction)sizeClicked:(id)sender{
	int clicked = (int) ([sender frame].size.width / 8);
	switch (clicked) {
		case 4:
			for(AnnotationView *annotationView in self.annotationViews){
				[annotationView setDrawWidth:8.0];
			}
			break;
		case 5:
			for(AnnotationView *annotationView in self.annotationViews){
				[annotationView setDrawWidth:10.0];
			}
			break;
		case 6:
			for(AnnotationView *annotationView in self.annotationViews){
				[annotationView setDrawWidth:14.0];
			}
			break;
		case 7:
			for(AnnotationView *annotationView in self.annotationViews){
				[annotationView setDrawWidth:20.0];
			}
			break;
		case 8:
			for(AnnotationView *annotationView in self.annotationViews){
				[annotationView setDrawWidth:28.0];
			}
			break;
		default:
			break;
	}
	[self.penWidthPopover dismissPopoverAnimated:YES];
}

@end
